@loading-cls: ~"@{prefix}loading";

@keyframes loading-rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes loading-path-rotate {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -35px;
  }
  100% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -124px;
  }
}

.@{loading-cls} {
  .h-func-fullscreen();
  background-color: fade(@white-color, 60%);
  z-index: -1;
  visibility: hidden;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s;
  & &-circular {
    .middle-center();
    height: 42px;
    >svg {
      opacity: 0;
      width: 42px;
      height: 42px;
      transition: opacity 0.5s;
      transform-origin: center center;
      .circle {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: 0;
        stroke-width: 2;
        stroke: @primary-color;
        stroke-linecap: round;
      }
    }
  }

  &&-loading{
    opacity: 1;
    &.@{loading-cls}-full-screen{
      z-index: @zindex-loading-fullscreen;
      position: fixed;
    }
  }

  &&-visible {
    visibility: visible;
    z-index: @zindex-loading;
    svg{
      opacity: 1;
      animation: loading-rotate 2s linear infinite;
      .circle{
        animation: loading-path-rotate 1.5s ease-in-out infinite;
      }
    }
  }
}

.h-loading-parent {
  position: relative;
  min-height: 200px;
}